/* jshint esversion: 6 */
const Router = require('koa-router');
const tool = require("../../tools/tool");
const router = new Router();
const {db, Op, QueryTypes} = require("../../models/db");
// 修改密码
router.post('/user/getUserById', async ctx => {
    let id = ctx.request.body.id
    let user = await db.models['admin'].findOne({
        where: {id: id}
    })
    let avatar = null
    if(user.avatar) {
        avatar = {
            fileName: user.avatar,
            url: tool.getPicUrl(user.avatar).url
        }
    }
    return ctx.suc('', {user, avatar})
})


module.exports = router;